package se.tinkerway.bomberman.domain;

import se.tinkerway.bomberman.domain.tile.Bomb;

public class Bomberman {
	public static final double SIZE=0.5;
	
	private Position position;
	private double runningSpeed = 0.1;
	private int bombPower = 2;
	private int maxBombCount = 10;
	private int currentBombCount;
	private TileMap map;
	
	public Bomberman(Position pos, TileMap map) {
		this.position = pos;
		this.map = map;
	}
	
	public void move(Position delta) {
		delta.x *= runningSpeed;
		delta.y *= runningSpeed;
		position = map.move(this, delta);
	}
	
	public void dropBomb() {
		if (currentBombCount < maxBombCount) {
			boolean ok = map.swawnIfEmpty(new Bomb(bombPower, 1000), position);
			if (ok) {
				currentBombCount++;
			}
		}
	}

	public Position getPosition() {
		return new Position(position);
	}

	public void die() {
		System.out.println("DEAD!!! " + this);
		// TODO: implement
	}

	public void addSpeed() {
		runningSpeed += 0.1;
	}
	
}
